import { axios } from '@/utils/request'

// 获取页面列表及页面控件列表
export const templateList = ({ url, data }) => {
  return axios({
    url,
    method: "get",
    params:data,
  });
};

export const delTemplate = (url = "/diy/template-del", data) => {
  return axios({
    url,
    method: "get",
    params:data,
  });
};

// 新建diy页面
export const createDiyPage = ({ url = "/diy/new-template-save", data }) => {
  return axios({
    url,
    method: "post",
    data,
  });
};

// 保存diy页面数据
export const saveDiyPage = ({ url = "/diy/new-template-save", data }) => {
  return axios({
    url,
    method: "post",
    data,
  });
};

// 保存diy系统页面
export const saveDiySysTemPage = ({
  url = "/diy/system-template-save",
  data,
}) => {
  return axios({
    url,
    method: "post",
    data,
  });
};

// 删除diy页面
export const deleteDiyPage = ({ url = "/diy/new-template-del", data }) => {
  return axios({
    url,
    method: "post",
    data,
  });
};

// 删除diy页面
export const setDiyIndexPage = ({ url = "/diy/new-up-down", data }) => {
  return axios({
    url,
    method: "post",
    data,
  });
};

// 获取系统页面列表
export const getDiySysTemPages = ({
  url = "/diy/system-template-list",
  data,
}) => {
  return axios({
    url,
    method: "get",
    params:data,
  });
};

export const link = ({ url, data }) => {
  return axios({
    url,
    method: "get",
    params:data,
  });
};

// 获取商品分类数据
export const getCatList = ({ url = "/goods/cat-list", data }) => {
  return axios({
    url,
    method: "get",
    params:data,
  });
};

// 获取点餐轮播图
export const getOrderMealBanners = ({
  url = "/plugins/food/banner/list",
  data,
}) => {
  return axios({
    url,
    method: "get",
    params:data,
  });
};

// 获取点餐轮播图
export const editOrderMealBanners = (data) => {
  return axios({
    url: "/plugins/food/banner/edit",
    method: "post",
    data,
  });
};

// 获取点餐轮播图
export const deleteOrderMealBanners = (data) => {
  return axios({
    url: "/plugins/food/banner/delete",
    method: "post",
    data,
  });
};

// 获取点餐轮播图
export const getOrderMealStore = (data) => {
  return axios({
    url: "/plugins/food/setting/get-setting",
    method: "get",
    params:data,
  });
};

// 获取点餐轮播图
export const updateOrderMealStore = (data) => {
  return axios({
    url: "/plugins/food/setting/set-logo",
    method: "post",
    data,
  });
};

// 获取点餐商品列表
export const getOrderMealListData = (data) => {
  return axios({
    url: "/plugins/food/goods/new-list",
    method: "get",
    params:data,
  });
};

export default {
  templateList,
  createDiyPage,
  saveDiyPage,
  saveDiySysTemPage,
  deleteDiyPage,
  delTemplate,
  setDiyIndexPage,
  link,
  getDiySysTemPages,
  getCatList,
  getOrderMealBanners,
  editOrderMealBanners,
  deleteOrderMealBanners,
  getOrderMealStore,
  updateOrderMealStore,
  getOrderMealListData,
};
